@extends('../manage.layout')
@section('content')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            系统配置
            <small>创建网站配置信息</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li>
            <li class="active">Here</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content animated fadeInRight">
        <div class="row">
            <div class="col-md-12">
                <!-- general form elements -->
                <div class="box-body table-responsive no-padding">
                    <div class="box box-primary">
                        <!-- /.box-header -->
                        <!-- form start -->
                        <form method="post" action="{{ url('manage/config/')}}" enctype=”multipart/form-data”>
                            <input type="hidden" name="_token" value="{{ csrf_token() }}">
                            <div class="box-body">
                                <div class="form-group">
                                    <label for="name">网站名称</label>
                                    <input type="text" id="name" class="form-control" name="name" value="" required="required">
                                </div>
                                <div class="form-group">
                                    <label for="rank">权重</label>
                                    <input type="number" min="0" class="form-control" id="rank" name="rank" value="0" required="required">
                                </div>
                                <div class="form-group">
                                    <label for="title">标题</label>
                                    <input type="text" class="form-control" id="title" name="title" value="" required="required">
                                </div>
                                <div class="form-group">
                                    <label for="keyword">关键词</label>
                                    <input type="text" class="form-control" id="keyword" name="keyword" value="" required="required">
                                </div>
                                <div class="form-group">
                                    <label for="description">说明</label>
                                    <textarea class="form-control" name="description" id="description" required="required"></textarea>
                                </div>
                                <div class="form-group">
                                    <label for="script">脚本代码</label>
                                    <textarea class="form-control" id="script" name="script" required="required"></textarea>
                                </div>
                            </div>
                            <!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">确定</button>&nbsp;&nbsp;<span class="btn btn-primary" onclick="window.location.href='/manage/config'">返回</span>
                            </div>
                         </form>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- /.content -->
@endsection
@section('script')
    <script src="/plugin/jquery/jquery-2.2.1.min.js"></script>
    <script src="/plugin/layer-2.4/layer.js"></script>
    <script type="text/javascript">
        $(function () {
            $("form").submit(function(event) {
                event.preventDefault();
                var url = $(this).attr('action');
                ajaxToken({
                    url: url,
                    type: "POST",
                    data: $("form").serialize(),
                    dataType: "json",
                    success: function(data) {
                        console.log(data);
                        layer.msg(data.msg);
                    }
                });
            });
        });
    </script>
@endsection
